package com.liuhouse.controller;

import com.liuhouse.annotation.mySystemlog;
import com.liuhouse.pojo.User;
import com.liuhouse.service.IUserService;
import com.liuhouse.utils.ResponseResult;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
@Api(tags = "用户相关接口" , description = "用户相关接口描述")
public class UserController {

    @Autowired
    private IUserService userService;

    /**
     * 获取用户信息
     * @return
     */
    @GetMapping("/userInfo")
    @mySystemlog(xxbusinessName = "查询个人信息")//描述接口,用于'日志记录的功能'
    public ResponseResult userInfo(){
        return userService.userInfo();
    }

    //更新个人信息
    @PutMapping("/userInfo")
    @mySystemlog(xxbusinessName = "更新个人信息")//描述接口,用于'日志记录的功能'
    public ResponseResult userInfo(@RequestBody User user){
        //更新个人信息
        return userService.updateUserInfo(user);
    }

    //用户进行注册
    @mySystemlog(xxbusinessName = "用户进行注册")//描述接口,用于'日志记录的功能'
    @PostMapping("/register")
    public ResponseResult register(@RequestBody User user){
        //注册功能
        return userService.register(user);
    }



}
